<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>trimStart 与 trimEnd</title>
  </head>
  <body>
    <script>
      // trim
      let str = "  iloveyou  ";

      console.log(str, str.length);
      console.log(str.trimStart(), str.trimStart().length);
      console.log(str.trimEnd(), str.trimEnd().length);
    </script>
  </body>
</html>
